
window.$alert=alert;

window.alert=function(msg){
	if(!msg) msg='系统繁忙，请稍后重试';
	swal({
		title: '',
		text: msg,
		confirmButtonText:'关闭',
		type: 'info',
		timer:2000
	});
}

window.$confirm=confirm;

window.confirm=function(msg,fn){
	swal({
		title: '',
		text: msg,
		type: 'warning',
		showCancelButton: true,
		confirmButtonColor: '#DD6B55',
		confirmButtonText: '确定',
		cancelButtonText: '取消',
		closeOnConfirm:false
	},fn);
}

window.success=function(msg,fn,btn,callback){
	var json={
			title: '',
			text: msg,
			type: 'success',
			confirmButtonText:'关闭'
		}
	if(!btn) json.timer=2000;
	if(btn){
		json.confirmButtonText='确定';
		json.confirmButtonColor='#DD6B55',
		json.showCancelButton=true;
		json.cancelButtonText='取消';
	}
	swal(json,fn);
	if(!callback) setTimeout(fn,2000);
}

